package com.leetcode.LC;

public class LC883 {
    public int projectionArea(int[][] grid) {

        int a = 0, b = 0, c = 0, max;
        for (int[] ints : grid) {
            max = -1;
            for (int anInt : ints) {
                if (anInt!=0){
                    c++;
                }
                max = Math.max(anInt, max);
            }
            a += max;
        }

        for (int i = 0; i < grid[0].length; i++) {
            max = grid[0][i];
            for (int j = 0; j < grid.length; j++) {
                max = Math.max(max, grid[j][i]);
            }
            b += max;
        }
        System.out.println(a+","+b+","+c);

        return a + b + c;
    }

}
